#!/usr/bin/env bash
source /etc/profile
if [ "${ENV}" = "" ]
then
  echo "please config env var:\n"
  echo "1.ENV,2.MYSQL_HOST,3.REDIS_HOST,4,MONGO_HOST\n"
fi
basepath=$(cd `dirname $0`; pwd)
cd ${basepath}
git pull
#必须要输入模块名称
if [[ "${1}" =  "" ]];then
    cd .
    servers=(excel)
#    servers=`ls . | egrep 'liveblockchain' | xargs`
    mvn clean -Dmaven.repo.local=/data0/temp/  -U -Dmaven.test.skip=true -pl com.foundao.excel:excel -am install

    for jarPackage in `find . -name excel*.jar `
    do
     rsync ${jarPackage} /data0/package/excelMerge
    done
    ls -l  /data0/package/excelMerge/
    #开始部署---
    echo "开始部署\n"
     cd ${basepath}
    /usr/local/bin/docker-compose -f docker-compose.yml stop
    /usr/local/bin/docker-compose -f docker-compose.yml up -d
fi

